﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:markup="clr-namespace:Elysium.Markup"
                    xmlns:params="clr-namespace:Elysium.Parameters">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Themes/SharedResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ScrollBarLineDownButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Background" Value="{markup:ThemeResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{markup:ThemeResource NormalBrush}"/>
        <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.DefaultThickness), Mode=OneWay}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <Polygon Points="0,0 3,4 6,0"
                                 Fill="{TemplateBinding BorderBrush}"
                                 StrokeThickness="0"
                                 Stretch="Uniform"
                                 Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollBar}}, Path=(params:ScrollBar.ArrowSize), Mode=OneWay}"
                                 Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollBar}}, Path=(params:ScrollBar.ArrowSize), Mode=OneWay}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{markup:ThemeResource HighlightBrush}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="BorderBrush" Value="{markup:ThemeResource BackgroundContrastBrush}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{markup:ThemeResource DisabledBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ScrollBarLineUpButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}">
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <RotateTransform Angle="180"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarLineLeftButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}">
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <RotateTransform Angle="-90"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarLineRightButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource ScrollBarLineDownButtonStyle}">
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <RotateTransform Angle="90"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarPageButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Background" Value="{markup:ThemeResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{markup:ThemeResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle Fill="{TemplateBinding Background}"
                               Stroke="{TemplateBinding BorderBrush}"
                               StrokeThickness="0"
                               SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>